#ifndef __TerrainDecal_H__
#define __TerrainDecal_H__

#include "Ogre.h"

/**
* A TerrainDecal is a mesh-decal that can 'wrap' itself to the terrain. It is used for arbitrarily
* projecting images/decals onto the terrain.
*/

class TerrainDecal
{
	Ogre::ManualObject* decal;
	Ogre::SceneNode* decalNode;
	Ogre::Vector2 dim;
	unsigned int res;
	Ogre::Real heightOffset;
	Ogre::RaySceneQuery* query;

	Ogre::Real getHeight(Ogre::Real x, Ogre::Real z);
public:
	TerrainDecal(const Ogre::String &name, const Ogre::String &material, const Ogre::Vector2 &dimensions, 
		const Ogre::Vector2 &position, Ogre::SceneManager* sceneMgr, Ogre::Real heightOffset = 0.5, unsigned int resolution = 4);

	~TerrainDecal();

	void moveTo(const Ogre::Vector2 &position);

	void hide();

	void show();

	bool isVisible() const;
};

#endif